//
//  OperatorViewController.swift
//  SwiftTest
//
//  Created by midea on 16/3/8.
//  Copyright © 2016年 Vincent. All rights reserved.
//

import Foundation
import UIKit

class OperatorViewController : BaseViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.titles = ["plus","remainder","oneYuan","range","logic"]
        self.tableView?.reloadData()
        
    }
    
    fileprivate func plus() {
        let hello = "hello"
        let world = "world"
        let string = hello + " " + world
        print(string)
    }
    
    fileprivate func remainder() {
        print(9%4)
        print(8.truncatingRemainder(dividingBy: 2.5))
    }
    
    fileprivate func oneYuan() {
        let int = 5
        print(-int)
        print(+int)
    }
    
    fileprivate func range() {
        for int in 1...5 {
            print(int)
        }
    }
    
    fileprivate func logic() {
        let logic : Bool = false
        if !logic {
            print("logic operation")
        }
    }
    
    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        super.tableView(tableView, didSelectRowAt: indexPath)
        
        switch indexPath.row{
        case 0:
            plus()
        case 1:
            remainder()
        case 2:
            oneYuan()
        case 3:
            range()
        case 4:
            logic()
        default:
            print("no more methods")
        }
    }
}
